package com.hello.system.service.impl;

import java.util.List;
import com.hello.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hello.system.mapper.DeviceMaintenanceLogMapper;
import com.hello.system.domain.DeviceMaintenanceLog;
import com.hello.system.service.IDeviceMaintenanceLogService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 设备维护记录Service业务层处理
 * 
 * @author hello
 * @date 2025-09-09
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class DeviceMaintenanceLogServiceImpl extends ServiceImpl<DeviceMaintenanceLogMapper, DeviceMaintenanceLog> implements IDeviceMaintenanceLogService 
{
    private final DeviceMaintenanceLogMapper deviceMaintenanceLogMapper;

    /**
     * 查询设备维护记录
     * 
     * @param maintenanceId 设备维护记录主键
     * @return 设备维护记录
     */
    @Override
    public DeviceMaintenanceLog selectDeviceMaintenanceLogByMaintenanceId(Long maintenanceId)
    {
        return deviceMaintenanceLogMapper.selectDeviceMaintenanceLogByMaintenanceId(maintenanceId);
    }

    /**
     * 查询设备维护记录列表
     * 
     * @param deviceMaintenanceLog 设备维护记录
     * @return 设备维护记录
     */
    @Override
    public List<DeviceMaintenanceLog> selectDeviceMaintenanceLogList(DeviceMaintenanceLog deviceMaintenanceLog)
    {
        return deviceMaintenanceLogMapper.selectDeviceMaintenanceLogList(deviceMaintenanceLog);
    }

    /**
     * 新增设备维护记录
     * 
     * @param deviceMaintenanceLog 设备维护记录
     * @return 结果
     */
    @Override
    public int insertDeviceMaintenanceLog(DeviceMaintenanceLog deviceMaintenanceLog)
    {
        deviceMaintenanceLog.setCreateTime(DateUtils.getNowDate());
        return deviceMaintenanceLogMapper.insertDeviceMaintenanceLog(deviceMaintenanceLog);
    }

    /**
     * 修改设备维护记录
     * 
     * @param deviceMaintenanceLog 设备维护记录
     * @return 结果
     */
    @Override
    public int updateDeviceMaintenanceLog(DeviceMaintenanceLog deviceMaintenanceLog)
    {
        deviceMaintenanceLog.setUpdateTime(DateUtils.getNowDate());
        return deviceMaintenanceLogMapper.updateDeviceMaintenanceLog(deviceMaintenanceLog);
    }


    /**
     * 批量删除设备维护记录
     * 
     * @param maintenanceIds 需要删除的设备维护记录主键
     * @return 结果
     */
    @Override
    public int deleteDeviceMaintenanceLogByMaintenanceIds(Long[] maintenanceIds)
    {
        return deviceMaintenanceLogMapper.deleteDeviceMaintenanceLogByMaintenanceIds(maintenanceIds);
    }

    /**
     * 删除设备维护记录信息
     * 
     * @param maintenanceId 设备维护记录主键
     * @return 结果
     */
    @Override
    public int deleteDeviceMaintenanceLogByMaintenanceId(Long maintenanceId)
    {
        return deviceMaintenanceLogMapper.deleteDeviceMaintenanceLogByMaintenanceId(maintenanceId);
    }
}
